<style>
    .layui-btn:not(.layui-btn-lg ):not(.layui-btn-sm):not(.layui-btn-xs) {height:34px;line-height:34px;padding:0 8px;}
    .layui-table-cell {
        height: auto ;
        white-space: normal;
    }
</style>
<body>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div >
            <table id="table" class="layui-table" lay-filter="table"></table>
        </div>
    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <a class="layui-btn layui-btn-normal layui-btn-sm" href="javascript:;" lay-event="add">添加</a>
    </div>
</script>
<!-- 状态列 -->
<script type="text/html" id="img">
    <!-- 这里的 checked 的状态只是演示 -->
    <img src="@{{d.img_src}}" alt="">
    {{--    <input type="checkbox" name="lock" value="@{{d.id}}" title="显示" lay-filter="lockDemo" @{{ d.status === 1  ? 'checked' : '' }}>--}}
</script>
<!-- 操作列 -->
<script type="text/html" id="auth-state">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    layui.use(['table', 'miniIndex'], function () {
        var $ = layui.jquery;
        var table = layui.table;
        var miniIndex = layui.miniIndex;

        // 渲染表格
        layer.load(2);
        var table_list = table.render({
            elem: '#table',
            url: 'config/list',
            toolbar: '#toolbarDemo',
            title: '模型数据表',
            page: true,
            limit: 10,
            cols: [[
                {type: 'numbers'},
                {field: 'config_type', title: '设置项'},
                {field: 'config_title', title: '标题'},
                {field: 'config_keywords', title: '关键词'},
                {field: 'config_description', title: '描述'},
                {field: 'created_at', title: '添加时间'},
                {field: 'updated_at', title: '更新时间'},
                {templet: '#auth-state', width: 120, align: 'center', title: '操作'}
            ]],
            done: function () {
                layer.closeAll('loading');
            }
        });

        /**
         * toolbar事件监听
         */
        miniIndex.ToolbarEvent('table','config/create');
        /**
         * 表格操作事件
         */
        miniIndex.tableEvent('config');
    });
</script>
</body>
